<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7016944</id><updated>2011-12-14T18:39:04.683-08:00</updated><category term='organize code window'/><category term='Visual Studio 2005 Add-ins'/><category term='Visual Class Organizer'/><category term='Inversion of Control'/><category term='Plug-ins'/><category term='Dependency Injection'/><category term='Developer Productivity Tools for .NET C# and VB.NET'/><title type='text'>Les Smith .NET Blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://les_knowdotnet.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7016944/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://les_knowdotnet.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Les Smith</name><uri>http://www.blogger.com/profile/08372532387301231690</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>12</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7016944.post-6669196154118826009</id><published>2010-01-12T17:28:00.000-08:00</published><updated>2010-01-12T17:35:29.169-08:00</updated><title type='text'>Use Find Method of Generic List</title><content type='html'>Is there a quick way to Find an object in a List&amp;lt;T&amp;gt; without looping through the List or using Linq?  Yes; use the Find Method of the object.&lt;br /&gt;&lt;br /&gt;If you are new to .NET, or even if you have been using it for years, but you still have outdated ways of doing things, you might be waisting developement time, resources, and performance if you do not keep up to date on new features that the .NET framework brings to the table for algorithms that you use all the time.&lt;br /&gt;&lt;br /&gt;For example, if you need to find an object in a generic List&amp;lt;T&amp;gt;, you might still be using code like the code shown below.  Suppose that you have a List&amp;lt;Address&amp;gt; and the Address object has an IsPrimary field (bool).  One and only one of the objects can be primary and you need to retrieve the primary address object from the List.  The "user" object has an Addressess property which is a List&amp;lt;Address&amp;gt;. The tried and proven (over and over) method for doing this would be:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Address primaryAddress;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;foreach (Address addr in user.Addresses)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;      if (addr.IsPrimary)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;      {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;primaryAddress = addr;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;      } // if&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;} // foreach&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Obviously, the code shown above works just fine.  But, consider the following line of code that will achieve the same result.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Address primaryAddr = &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;user.Addresses.Find(delegate(Address obj) &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{ return obj.IsPrimary; });&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Passing a Delegate to the Find method of the generic List&amp;lt;Address&amp;gt; finds the object that has the IsPrimary field set to true with a single line of code.  &lt;br /&gt;&lt;br /&gt;Just another shortcut that hopefully will save you some time.&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Need to automatically organize your code windows?  You'll be amazed how easy it is to keep the code in your code windows organized.  &lt;A TARGET='_blank' HREF='http://knowdotnet.com/articles/visualorganizerproducthome.html'&gt;TRY IT FREE FOR 30 DAYS BY CLICKING HERE.&lt;/A&gt;&lt;/h4&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Automatically generate braces in C#! Try CSharpCompleter and stop wasting valuable time needlessly typing hundreds of braces {} daily.  Try &lt;A TARGET='_blank' HREF='http://www.knowdotnet.com/articles/csharpcompleter.html'&gt;CSharpCompleter&lt;/A&gt; for 30 DAYS FREE.&lt;/h4&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;You can also email me directly at les@KnowDotNet.com.&lt;/h4&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7016944-6669196154118826009?l=les_knowdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://les_knowdotnet.blogspot.com/feeds/6669196154118826009/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7016944&amp;postID=6669196154118826009' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7016944/posts/default/6669196154118826009'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7016944/posts/default/6669196154118826009'/><link rel='alternate' type='text/html' href='http://les_knowdotnet.blogspot.com/2010/01/use-find-method-of-generic-list.html' title='Use Find Method of Generic List&lt;T&gt;'/><author><name>Les Smith</name><uri>http://www.blogger.com/profile/08372532387301231690</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7016944.post-6757697134306499213</id><published>2010-01-12T17:04:00.000-08:00</published><updated>2010-01-13T09:02:21.532-08:00</updated><title type='text'>Using a LIKE Operator in a Stored Procedure</title><content type='html'>How do I code the Stored Procedure and the parameter to it to use the LIKE operator?&lt;br /&gt;The answer should seem quite simple, but it is not exactly as you would do it in dynamic sql. It is almost the same with a subtile difference. In dynamic sql, you might do something like this:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;   &amp;nbsp;&amp;nbsp;&amp;nbsp;string searchText = "register";&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;string sql = "select * from FAQs where QuestionColumn LIKE '%"       &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;+ searchText + "%'";&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;to create the dynamic sql statement, and it will work fine. However, it does not appear that passing a parameter value like the following code works in the Stored Procedure; at least it failed to make a find for me, even though I had copied the code from VBScript in an old ASP page, where it was working.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;   string searchString = "'%register%'";&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;sqlCommand.Parameters.Add(new SqlParameter("@SearchString",&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;SqlDbType.VarChar, 50));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;sqlCommand.Parameters[0].Value = searchString;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;and the code in the stored procedure was:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;SELECT Question, Answer&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;FROM SP_FAQs&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;WHERE Question LIKE @SearchString&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;OR Answer LIKE @SearchString&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;So, to get it to work, I changed the parameter setting code to:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;    string searchString = "register";&lt;br /&gt;    &amp;nbsp;&amp;nbsp;&amp;nbsp;sqlCommand.Parameters.Add(new SqlParameter("@SearchString",&lt;br /&gt;       &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;SqlDbType.VarChar, 50));&lt;br /&gt;    &amp;nbsp;&amp;nbsp;&amp;nbsp;sqlCommand.Parameters[0].Value = searchString;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;and the Stored Procedure code to the following:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;SELECT Question, Answer&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;FROM SP_FAQs&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;WHERE Question LIKE '%' + @SearchString + '%'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;OR Answer LIKE '%' + @SearchString + '%'&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The subtile difference is that the adding of the "%" to the beginning and end of the parameter is done inside the Stored Procedure instead of passing it in with the parameter. Even if somehow I made a simple mistatke that was causing the search to fail, it is still better to have the stored procedure do the work of enclosing the searchString in "%" than for each call have to worry about passing in anything but the actual text for which to search.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Need to automatically organize your code windows? You'll be amazed how easy it is to keep the code in your code windows organized. &lt;a href="http://www.blogger.com/" target="'_blank'"&gt;TRY IT FREE FOR 30 DAYS BY CLICKING HERE.&lt;/a&gt;&lt;/h4&gt;&lt;br /&gt;&lt;h4&gt;Automatically generate braces in C#! Try CSharpCompleter and stop wasting valuable time needlessly typing hundreds of braces {} daily. Try &lt;a href="http://www.blogger.com/" target="'_blank'"&gt;CSharpCompleter&lt;/a&gt; for 30 DAYS FREE.&lt;/h4&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;You can also email me directly at les@KnowDotNet.com.&lt;/h4&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7016944-6757697134306499213?l=les_knowdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://les_knowdotnet.blogspot.com/feeds/6757697134306499213/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7016944&amp;postID=6757697134306499213' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7016944/posts/default/6757697134306499213'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7016944/posts/default/6757697134306499213'/><link rel='alternate' type='text/html' href='http://les_knowdotnet.blogspot.com/2010/01/how-do-i-code-stored-procedure-and.html' title='Using a LIKE Operator in a Stored Procedure'/><author><name>Les Smith</name><uri>http://www.blogger.com/profile/08372532387301231690</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7016944.post-7159885104822802952</id><published>2009-09-17T11:21:00.000-07:00</published><updated>2009-09-17T11:26:36.988-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Plug-ins'/><category scheme='http://www.blogger.com/atom/ns#' term='Dependency Injection'/><category scheme='http://www.blogger.com/atom/ns#' term='Inversion of Control'/><title type='text'>Writing Plug-Ins for Loose Coupling of Application Components</title><content type='html'>How do I write a Plug-in for an application and how do I know whether a DLL implements an Interface that my application expects?  Dependency Injection and Inversion of Control are hot topics in OOP development today.  These terms sound complex and their implementation can indeed be complex.  There are several ways of implementing Dependency Injection, but in this article I am going to describe a type of DI that is not normally covered under the definition of this term.&lt;br /&gt;&lt;br /&gt;Check out my article at &lt;a href="http://www.knowdotnet.com/articles/pluginsusingreflection.html"&gt;http://www.knowdotnet.com/articles/pluginsusingreflection.html&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;While you are there, take a look at Visual Class Organizer, a time saving tool for automatically organizing your classes.  click on the following link to download a Free 30 Day Trial.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.knowdotnet.com/articles/VisualOrganizerProductHome.html"&gt;http://www.knowdotnet.com/articles/VisualOrganizerProductHome.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7016944-7159885104822802952?l=les_knowdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://les_knowdotnet.blogspot.com/feeds/7159885104822802952/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7016944&amp;postID=7159885104822802952' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7016944/posts/default/7159885104822802952'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7016944/posts/default/7159885104822802952'/><link rel='alternate' type='text/html' href='http://les_knowdotnet.blogspot.com/2009/09/writing-plug-ins-for-loose-coupling-of.html' title='Writing Plug-Ins for Loose Coupling of Application Components'/><author><name>Les Smith</name><uri>http://www.blogger.com/profile/08372532387301231690</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7016944.post-2969462502048964278</id><published>2009-09-17T11:15:00.000-07:00</published><updated>2009-09-17T11:27:42.676-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Developer Productivity Tools for .NET C# and VB.NET'/><title type='text'>Disable or Change the Way Windows Updates Are Performed</title><content type='html'>Are you constantly having the Windows Update popup tell you that Windows has been upadated and is going to reboot? Have you forgotten and lost some of your work because of an automatic reboot? Here is how to change the way that Windows Updates work.&lt;br /&gt;&lt;br /&gt;Check out a new article at&lt;br /&gt;&lt;a href="http://www.knowdotnet.com/articles/windowsupdates.html"&gt;http://www.knowdotnet.com/articles/windowsupdates.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;While you are there, take a look at Visual Class Organizer, a time saving tool for organizing your classes. Click the link below for a 30 Day Free Trial.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.knowdotnet.com/articles/VisualOrganizerProductHome.html"&gt;http://www.knowdotnet.com/articles/VisualOrganizerProductHome.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7016944-2969462502048964278?l=les_knowdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://les_knowdotnet.blogspot.com/feeds/2969462502048964278/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7016944&amp;postID=2969462502048964278' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7016944/posts/default/2969462502048964278'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7016944/posts/default/2969462502048964278'/><link rel='alternate' type='text/html' href='http://les_knowdotnet.blogspot.com/2009/09/disable-or-change-way-windows-updates.html' title='Disable or Change the Way Windows Updates Are Performed'/><author><name>Les Smith</name><uri>http://www.blogger.com/profile/08372532387301231690</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7016944.post-4381236173311926519</id><published>2007-07-10T17:28:00.000-07:00</published><updated>2007-07-10T17:48:17.490-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Visual Class Organizer'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio 2005 Add-ins'/><category scheme='http://www.blogger.com/atom/ns#' term='organize code window'/><title type='text'></title><content type='html'>At KnowDotNet, I have just released a hot new product called Visual Class Organizer. If you would like to automatically organize your code window by logical groups of code elements, sort your code elements within the groups, and optionally surround the groups with Regions, it can all be done visually with Visual Class Orgainzer.&lt;br /&gt;&lt;br /&gt;I have spent well over a year in the development of this exciting new product. It came from a need of my own to have a way to do everything that I have described above in a visual way. The product allows you to organize a code window in a matter of seconds, regardless of how much code you may have in it.&lt;br /&gt;&lt;br /&gt;In addition to the automatic options, you can manually organize your code window with drag and drop in a dialog that provides complete freedom and power to do it your way.&lt;br /&gt;&lt;br /&gt;Try the free 30-day trial at&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.knowdotnet.com/articles/VisualOrganizerProductHome.html"&gt;http://www.knowdotnet.com/articles/VisualOrganizerProductHome.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;You can also watch a short video that demos the power of the add-in by clicking the demo link on the same page.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7016944-4381236173311926519?l=les_knowdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://les_knowdotnet.blogspot.com/feeds/4381236173311926519/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7016944&amp;postID=4381236173311926519' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7016944/posts/default/4381236173311926519'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7016944/posts/default/4381236173311926519'/><link rel='alternate' type='text/html' href='http://les_knowdotnet.blogspot.com/2007/07/at-knowdotnet-i-have-just-released-hot.html' title=''/><author><name>Les Smith</name><uri>http://www.blogger.com/profile/08372532387301231690</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7016944.post-116553561290766051</id><published>2006-12-07T15:53:00.000-08:00</published><updated>2006-12-07T15:53:33.130-08:00</updated><title type='text'>Les Smith .NET Blog</title><content type='html'>I just posted a rather lengthy article on extending the functionality of the CodeModel or better yet, the FileCodeModel.  In spite of the functionality that it has, it still lacks functionality and this article shows some neat tricks for finding and retrieveing code that the CodeModel cannot do.&lt;br /&gt;&lt;br /&gt;I think you will find some help here, if you are interested in the CodeModel, Regexes, and extensibility in general.  Hope you like it.&lt;br /&gt;&lt;br /&gt;The link is &lt;br /&gt;&lt;br /&gt;http://www.knowdotnet.com/articles/extendingthecodemodel.html&lt;br /&gt;&lt;br /&gt;Take a look.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7016944-116553561290766051?l=les_knowdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://les_knowdotnet.blogspot.com/feeds/116553561290766051/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7016944&amp;postID=116553561290766051' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7016944/posts/default/116553561290766051'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7016944/posts/default/116553561290766051'/><link rel='alternate' type='text/html' href='http://les_knowdotnet.blogspot.com/2006/12/les-smith-net-blog.html' title='Les Smith .NET Blog'/><author><name>Les Smith</name><uri>http://www.blogger.com/profile/08372532387301231690</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7016944.post-114625644631160735</id><published>2006-04-28T13:15:00.000-07:00</published><updated>2006-04-28T13:40:53.336-07:00</updated><title type='text'>Programmers do the dumbest things</title><content type='html'>Ever do something really stupid in your code? I bet you can't say "No" with a straight face. But, don't you get irritated when you encounter someone else's blunders. I have found some real dillys lately and thought I might run them by anyone that ever reads my blog, which at this point is not a lot of people.&lt;br /&gt;&lt;br /&gt;It seems that a lot of self-named .NET developers totally don't understand Exception Handling! For example, explain the need for the following Try Catch block, if you can.&lt;br /&gt;&lt;br /&gt;private void DoNothing()&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;try&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// do some code&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;catch(Exception ex)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;throw(ex);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Did it never occur to the writer of this code that if they had not coded the try catch, that the results of a failure in the DoNothing method will be exactly the same. The try catch as coded basically is an unhandled exception, which could have been raised without the try catch.&lt;br /&gt;&lt;br /&gt;Here's one more that completely baffled me when I came upon it recently.&lt;br /&gt;&lt;br /&gt;Try&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;IO.File.Move(oldPath, newPath)&lt;br /&gt;Catch (ex As Exception)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;IO.File.Move(oldPath, newPath)&lt;br /&gt;End Try&lt;br /&gt;&lt;br /&gt;Go Figure! What is this? "If at first you don't succeed, Try, Try again?"&lt;br /&gt;&lt;br /&gt;Take a minute and comment with something really dumb that you have done or seen.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7016944-114625644631160735?l=les_knowdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://les_knowdotnet.blogspot.com/feeds/114625644631160735/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7016944&amp;postID=114625644631160735' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7016944/posts/default/114625644631160735'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7016944/posts/default/114625644631160735'/><link rel='alternate' type='text/html' href='http://les_knowdotnet.blogspot.com/2006/04/programmers-do-dumbest-things.html' title='Programmers do the dumbest things'/><author><name>Les Smith</name><uri>http://www.blogger.com/profile/08372532387301231690</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7016944.post-114625518758293755</id><published>2006-04-28T13:08:00.000-07:00</published><updated>2006-04-28T13:13:07.596-07:00</updated><title type='text'>Infamous Last Words</title><content type='html'>Programmers are infamous for trying to pass the buck when there appears to be a problem with their program and they are facing their accuser who is pointing the finger at them.  For many years I have been amused at the new answers that the “innocent” developer comes up with before finally having to admit that they blew it.  A short list is compiled below. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;“Sounds like a hardware problem to me…”&lt;br /&gt;&lt;br /&gt;“I only changed one line and it wasn’t in that area of the program…”&lt;br /&gt;&lt;br /&gt;“It runs on my machine…”&lt;br /&gt;&lt;br /&gt;“I tested it once and it ran ok.  If it runs once, it will run every time, right?”&lt;br /&gt;&lt;br /&gt;“I only made a change to the database; it would not cause a problem in the program…”&lt;br /&gt;&lt;br /&gt;“The program has been running for 5 months and I never had a problem, I don’t think it’s the program…”&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;"Why would you ask if the change had been through QA?"&lt;br /&gt;&lt;br /&gt;This one really backfires when you tell the user, who is a customer, “It sounds like an ID10T Error.”  I personally don’t recommend that one be used at all.&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;Should you have some that you have heard, please comment on this blog.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7016944-114625518758293755?l=les_knowdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://les_knowdotnet.blogspot.com/feeds/114625518758293755/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7016944&amp;postID=114625518758293755' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7016944/posts/default/114625518758293755'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7016944/posts/default/114625518758293755'/><link rel='alternate' type='text/html' href='http://les_knowdotnet.blogspot.com/2006/04/infamous-last-words.html' title='Infamous Last Words'/><author><name>Les Smith</name><uri>http://www.blogger.com/profile/08372532387301231690</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7016944.post-114000941489934056</id><published>2006-02-15T04:54:00.000-08:00</published><updated>2006-02-15T05:16:54.923-08:00</updated><title type='text'>VS2005 .NET Add-Ins Nested Menus</title><content type='html'>Writing an add-in for Visual Studio .NET always brings it's challenges.  With every release of .NET, if you are an ISV, as I am, there are several challenges.&lt;br /&gt;&lt;br /&gt;First, you have to see what features of your add-ins that Microsoft has implemented in the new IDE.  When they do this, and I have never seen a new version since VB4 that did not implement something that I had previously done in one of my add-ins and it is no longer needed in a new version. &lt;br /&gt;&lt;br /&gt;Sometimes, the way Microsoft implements it, you can find a way to do more than they have done it, and with greater functionality.  You are not much of a programmer, if you can look at functionality and not improve on it, or look at a medium to large block of code and not be able to improve, reorganize, or make it be more efficient, etc.&lt;br /&gt;&lt;br /&gt;Another challenge is to look at the new IDE and see if you can find something that is useful that MS has not implemented.  If you are an application developer and you write add-ins as I do, you have an advantage over Microsoft in that you are using the IDE every minute of everyday and you constantly run into tasks that are repetitive and that just say, "automate me."&lt;br /&gt;&lt;br /&gt;Finally, there is the challenge of finding out what has changed in the automation or extensibility model of the new release that breaks your add-ins.  It's not usually hard to find out what is broken, the real challenge is to find out how to fix it.&lt;br /&gt;&lt;br /&gt;That is the case with menus in add-ins in VS2005.  Microsoft created a trimmed down version of Microsoft Office CommandBars.  At first you think, "this is neat."  At a second look, you find there is no free lunch.  The cost here is that the command bars and their associated events do not work exactly the same as the MS Office counterpart.  Especially is this true with respect to event handlers for the menus.  I thought I would never get them working, and said, "nothing is this hard!"  And actually it isn't; all you have to do is discover what the one way that it will work is.&lt;br /&gt;&lt;br /&gt;I finally did and have posted an article on KnowDotNet so that you hopefully won't have the agony that I experienced.  The article is at &lt;a href="http://www.knowdotnet.com/articles/nestedmenusinvs2005.html"&gt;http://www.knowdotnet.com/articles/nestedmenusinvs2005.html&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;I hope you will find it helpful.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7016944-114000941489934056?l=les_knowdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://les_knowdotnet.blogspot.com/feeds/114000941489934056/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7016944&amp;postID=114000941489934056' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7016944/posts/default/114000941489934056'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7016944/posts/default/114000941489934056'/><link rel='alternate' type='text/html' href='http://les_knowdotnet.blogspot.com/2006/02/vs2005-net-add-ins-nested-menus.html' title='VS2005 .NET Add-Ins Nested Menus'/><author><name>Les Smith</name><uri>http://www.blogger.com/profile/08372532387301231690</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7016944.post-113997101127977376</id><published>2006-02-14T18:28:00.000-08:00</published><updated>2006-02-14T18:36:51.290-08:00</updated><title type='text'></title><content type='html'>I have just uploaded NetRefactor2005 on the KnowDotNet site.  It has all the features of NetRefactor for previous versions of Visual Studio .NET.  It was a while in being released because of learning to deploy addins in VS2005.&lt;br /&gt;&lt;br /&gt;Microsoft did remove some of the "COM" ness from addins in VS2005, but the Addin Wizard does not do as much for you in the new version.  It actually does nothing for you in the setup and deployment area.  In fact, it does not even create a Setup project for you.  Deployment is completely up to the developer.  I have written an article on deployment at &lt;a href="http://knowdotnet.com/articles/addininstallation.html"&gt;http://knowdotnet.com/articles/addininstallation.html&lt;/a&gt;.  It has some useful code that will help you to get your addins deployed.&lt;br /&gt;&lt;br /&gt;I am beginning to write articles on addin development for VS2005.  I would like feedback or suggestions on articles that developers would like to see on this or other .NET subjects.  I can't write on everything, but my partners and I together can take a crack at a lot of subjects.&lt;br /&gt;&lt;br /&gt;Let me hear from you.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7016944-113997101127977376?l=les_knowdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://les_knowdotnet.blogspot.com/feeds/113997101127977376/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7016944&amp;postID=113997101127977376' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7016944/posts/default/113997101127977376'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7016944/posts/default/113997101127977376'/><link rel='alternate' type='text/html' href='http://les_knowdotnet.blogspot.com/2006/02/i-have-just-uploaded-netrefactor2005.html' title=''/><author><name>Les Smith</name><uri>http://www.blogger.com/profile/08372532387301231690</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7016944.post-108566963470273553</id><published>2004-05-27T07:45:00.000-07:00</published><updated>2004-05-27T07:53:54.703-07:00</updated><title type='text'>Book Review - Microsoft Visual Basic .NET Programmer's Cookbook</title><content type='html'>I have just posted a book review on Matthew MacDonald's VB.NET Programmer's Cookbook.  You can read it at &lt;a href="http://www.knowdotnet.com/lessmith.html"&gt;See Les's Articles&lt;/a&gt;.  This is one of the most helpful books that I have ever owned, a must have for anyone new to the .NET Framework.  Although I have been developing in VB.NET since Beta 1, I still refer to this book regularly.  If you are new to VB.NET, this is a must have book.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7016944-108566963470273553?l=les_knowdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://les_knowdotnet.blogspot.com/feeds/108566963470273553/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7016944&amp;postID=108566963470273553' title='12 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7016944/posts/default/108566963470273553'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7016944/posts/default/108566963470273553'/><link rel='alternate' type='text/html' href='http://les_knowdotnet.blogspot.com/2004/05/book-review-microsoft-visual-basic-net.html' title='Book Review - Microsoft Visual Basic .NET Programmer&apos;s Cookbook'/><author><name>Les Smith</name><uri>http://www.blogger.com/profile/08372532387301231690</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>12</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7016944.post-108480483583137437</id><published>2004-05-17T07:31:00.000-07:00</published><updated>2004-05-17T07:40:35.830-07:00</updated><title type='text'>Refactoring in Visual Studio .NET</title><content type='html'>I have just posted three articles on refactoring code in Visual Studio .NET.  They are the first of several more I hope to write.  I certainly don't tout myself as an expert on the subject.  We at KnowDotNet have just launched a new product called NET Refactor.  Like most add-ins that I write, it comes from a need to automate tasks that I repeat many times a day.  Although I did most of the work on this product, it could not have been done without a lot of help from Brian Davis, who has helped me and written many of the Regular Expressions that are the heart of this add-in.  Bill Ryan provided a lot of input regarding functionality and testing.&lt;br /&gt;&lt;br /&gt;I look forward to getting feed back on the add-in.  The primary goal in establishing our site was to disseminate knowledge.  If we make a buck occassionaly, that won't bother us either.&lt;br /&gt;&lt;br /&gt;If you ask anyone who has emailed us with questions, you will find that we always try to respond, in a timely manner, and hopefully with a solution the to posed question.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7016944-108480483583137437?l=les_knowdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://les_knowdotnet.blogspot.com/feeds/108480483583137437/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7016944&amp;postID=108480483583137437' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7016944/posts/default/108480483583137437'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7016944/posts/default/108480483583137437'/><link rel='alternate' type='text/html' href='http://les_knowdotnet.blogspot.com/2004/05/refactoring-in-visual-studio-net.html' title='Refactoring in Visual Studio .NET'/><author><name>Les Smith</name><uri>http://www.blogger.com/profile/08372532387301231690</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry></feed>
